'use strict';

function median_to_letter(collection) {
  function sortnumber(a,b){
    return a-b;
  }
  collection.sort(sortnumber);
  let l=collection.length;
  let median;
  if(l%2==1){
    median=collection[(l+1)/2-1];
  }
  else{
    median=(collection[l/2-1]+collection[l/2])*0.5; 
  }
  median=Math.ceil(median);
  let result;
  let a=parseInt(median/26);
  let b=median%26;
  if(b==0){
    if(a==1){
      result=z;
    }
    else{
      result=String.fromCharCode(96+a-1)+'z';
    }
  }
  else{
    if(a==0){
      result=String.fromCharCode(96+b);
    }
    else{
      result=String.fromCharCode(96+a,96+b);
    }
  }
  return result;
}

module.exports = median_to_letter;
